<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/model/order.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/dto/orderdto.php');
error_reporting(0);

$limit = $_GET['limit'];
$skip = $_GET['skip'];
$orderBy = $_GET['orderBy'];
$filters = $_GET['filters'];
$addRfids = $_GET['addRfids'];
$identifier = $_GET['identifiers'];

$t=new Order();

if($filters == "checkedOrders") {
  $orders = $t->loadCheckedByLimit($limit);
} else {
  $orders = $t->loadByLimit($limit);
}

$list=array();
foreach($orders as $order) {
  array_push($list, new Orderdto($order));
}

echo json_encode($list);

?>